package com.rd.student.jike.class4.wanghaixin.test0728;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;


    public class Test {
        public static void main(String[] args) throws Exception{
            int n = 4;
            File file = new File("zrrdClass");
            Reader reader = new FileReader(file);
            char[] arr = new char[(int) file.length()];
            reader.read(arr);
            System.out.println(new String(arr));
            reader.close();
            ArrayList<String> list = new ArrayList<>();
            String s = "";
            for (int i = 0; i < arr.length; i++) {
                if(arr[i]=='、'){
                    list.add(s);
                    s="";
                }else{
                    s = s+arr[i];
                }
            }
//        Collections.shuffle(list);
            System.out.println(list);
            Collections.shuffle(list);
            s="";
            for (int i = 0; i < n; i++) {
                s=s+list.get(i)+",";
                System.out.println(list.get(i));
            }
            File file1 = new File("class2");
            Writer writer = new FileWriter(file1);
            writer.write(s);
            writer.close();
        }
    }


